﻿/*
 * Created by SharpDevelop.
 * User: zbyn
 * Date: 2010-10-15
 * Time: 18:05
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Drawing;
using System.Windows.Forms;

namespace IMPlugin
{
	using bedrock.util;
	
	/// <summary>
	/// Description of SendMessage.
	/// </summary>
	public partial class SendMessage : Form
	{
		private jabber.client.JabberClient m_jc;
		
		public SendMessage(jabber.client.JabberClient jc, string toJid) : this(jc)
        {
            txtTo.Text = toJid;
        }
		
		public SendMessage(jabber.client.JabberClient jc)
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			m_jc = jc;
		}
		
		void BtnSend_Click(object sender, EventArgs e)
		{
			jabber.protocol.client.Message msg = new jabber.protocol.client.Message(m_jc.Document);
            msg.To = txtTo.Text;
            if (txtSubject.Text != "")
                msg.Subject = txtSubject.Text;
            msg.Body = txtBody.Text;
            m_jc.Write(msg);
            this.Close();
		}
	}
}
